<?php 
$this->load->view('user/head'); 
$this->load->view('user/header');
?>
<style>
.err2{ color:red; }
</style>
<div class="space40"></div>
<img src="<?php echo ASSET_URL.'img/slider/02.jpg';?>" alt=""> 
  <!-- Content -->  
  <div class="container">
    <div class="row"> 
    <div class="col-md-3 col-xs-12">
      <!--user_profile starts-->
      	<div class="user_profile">
        
           	<div class="user">
           	<div class="user_image" style=" background-position:center center;  background-image:url(<?php if($result[0]->user_profile_photo==NULL){ echo ASSET_URL.'img/user.png';} else { echo $result[0] -> user_profile_photo; } ?>) ; background-repeat:no-repeat;">
           	</div>
            <div class="user_name">
                      <?php  echo $result[0]->user_first_name; ?>
            </div>
            <div class="clearfix"></div>
            <div class="bottom_image">
            <img src="<?php echo ASSET_URL.'img/bottom_image.png';?>">
            </div>
            </div>
          <div class="Contact_type">
           	<h3>Contact</h3>
            <a href="javascript:void(0);"> <?php echo $result[0]->user_email; ?></a>
          </div>
           <!--<div class="edit_profile">
       	  	<a href="#">EDIT PROFILE</a>
          </div>-->
		</div>
      <!--user_profile ends-->
      </div>
      <div class="col-md-9 col-xs-12">
      <!--form_details starts-->
      	<div class="form_details">
  			<div class="space30"></div>  
            <span style="color: green;font-size: 18px;" ><?php echo $this->session->userdata('update_message'); $this->session->unset_userdata('update_message'); ?></span>
            <!--form_container starts-->
            	<div class="form_container">
            		<h4>Name</h4>
                    <!--row starts-->
                    	<form action="#" method="post" enctype="multipart/form-data">
                    	<div class="row1">
                    	<div class="form-group col-sm-6">
                        	<label for="name2">First Name </label>
                            <input class="form-control white" id="fname" name="fname" type="text" value="<?php if($this->input->post('fname')){ echo $this->input->post('fname'); } else { echo $result[0]->user_first_name; } ?>">
                            <div class="error" id="err-name">Please enter first name</div>
                        </div>
                        
                        
                        <div class="form-group col-sm-6">
                             <label for="name4">Last Name</label>
                             <input  class="form-control white" id="lname" name="lname"  type="text" value="<?php if($this->input->post('lname')){ echo $this->input->post('lname'); } else { echo $result[0]->user_last_name; }?>">
                             <div class="error" id="err-name1">Please enter last name</div> 
                        </div>
                        <div class="clearfix"></div>
                    </div>
                    <!--raw closed-->
                </div>
            <!--form_container starts-->
            <div class="space30"></div>
            <!--form_container starts-->
            	<div class="form_container">
            		<h4>Personal Details</h4>
                    <!--row starts-->
                    	<div class="form-group col-sm-6">
                             <label for="Country">Country</label>
                             <select class="form-control white" name="Country">
              <?php foreach($query as $row)	{ ?>
              	<option id="Country" value="<?php echo $row->country_id; $line=$row->country_id?>" <?php if($this->input->post('Country') && $this->input->post('Country')==$line){ echo 'selected';} else { if($result[0]->user_country==$line) { echo 'selected'; } } ?>><?php echo $row->country_name;?></option>
			  <?php } ?>
              </select>
              <?php echo form_error('counrty'); ?>
                             <div class="error" id="err-name1">Please choose a country</div> 
                        </div>
                        
                        
                        <div class="clearfix"></div>
                        
                    </div>
                    <!--raw closed-->
                </div>
            <!--form_container starts-->
            <div class="space30"></div>
            <!--form_container starts-->
            	<div class="form_container">
            		<h4>Contact Details</h4>
                    <!--row starts-->
                    	<div class="row1">
                    	<div class="form-group col-sm-6">
                        	<label for="email">Email</label>
                            <input class="form-control white" id="emailid" name="email"type="text" value="<?php echo $result[0]->user_email; ?>" readonly>
                            <div class="error" id="err-email"></div>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                    <!--raw closed-->
                </div>
            <!--form_container starts-->
            <div class="space30"></div>
            <!--form_container starts-->
            	<div class="form_container">
            		<h4>Photo</h4>
                    <!--row starts-->
                    	<div class="row1">
                        
                            <div class="form-group col-sm-4">
                                <label for="name2">Upload Photo </label>
                              		<input type="file" name="userfile" class="form-control white">
                                <div class="error" id="err-name"></div><span><?php echo "Allowed Files( jpeg,jpg, png )"; ?></span><br>
                                <span class="err2"><?php if (isset($error)){echo $error; }?></span>
                            </div>
                        <div class="clearfix"></div>
                    </div>
                    <!--raw closed-->
                </div>
            <!--form_container starts-->
            <!--form_container starts-->
            	<div class="form_container">
            		<h4>Password Change</h4>
                    <!--row starts-->
                    	<div class="row1">
                        
                    	<div class="form-group col-sm-6">
                                <label for="name2">New Password</label>
                              		<input type="password" name="npassword" class="form-control white">
                                <div class="error" id="err-name"></div><span><?php echo "Leave empty if not updating password"; ?></span><br>
                                <span class="err2"><?php echo form_error('npassword');?></span>
                            </div>
                    	<div class="form-group col-sm-6">
                                <label for="name2">Confirm Password</label>
                              		<input type="password" name="cpassword" class="form-control white">
                                <div class="error" id="err-name"></div><span><?php echo "Leave empty if not updating password"; ?></span><br>
                                <span class="err2"><?php echo form_error('cpassword');?></span>
                            </div>
                        <div class="clearfix"></div>
                    </div>
                    <!--raw closed-->
                </div>
            <!--form_container starts-->
            <div class="space30"></div>
            <input type="submit" name="submit" class="btn btn-primary" value="Save & Continue"/>
        </div>
        </form>
      <!--form_details ends-->
      </div>
      <div class="clearfix"></div>
      <div class="space90"></div>  
    </div> 
  </div> 
  <div class="space30"></div>  
  <!-- Content End -->
<?php $this -> load -> view('user/footer'); ?>